#ifndef _INC_ARRAY_T_H_
#define _INC_ARRAY_T_H_

#include "Container_t.h"

template<class T>
class Array_t
	: public Container_t<T>
{
public:
	/**
	* Ctor
	*/
	Array_t();

	/**
	* Dtor
	*/
	virtual ~Array_t();

	/**
	* Copy Ctor
	*/
	Array_t(const Array_t& other);

	/**
	* Assignment operator
	*/
	Array_t& operator=(const Array_t& other);

	/**
	* Operator[]
	*/
	const T& operator[](int index) const;

protected:
	/**
	* Returns next elem in list
	*/
	T* next();

	/**
	* Returns previous elem in list
	*/
	T* prev();

	/**
	* Resets inner list iterator
	*/
	void reset();

	/**
	* Inserts elem after given index in container
	* Precondition: -1 <= index <= count() - 1
	*/
	void doAppend(T* const elem, int index);

	/**
	* Removes elem with given value from container
	*/
	void doRemove(const T& value);

	/**
	* Removes all elements from container
	*/
	void doRemoveAll();

	/**
	* Removes and deletes all elements from container
	*/
	void doRemoveAndDeleteAll();

	/**
	* Returns container iterator
	* Releasing iterator is up to caller
	*/
	Iterator_t<T>* iterator() const;

	/**
	* Returns TRUE if array is full, FALSE o.w.
	*/
	bool isFull() const;

private:
	template<class Ty>
	friend class ArrayIterator_t; // Iterator declaration

	size_t m_size; //Total size of array
	
	size_t m_capacity; // Capacity of array
	
	T** m_impl; // Array of pointers to type T
	
	int currCell; // Indicating current cell

	static size_t expandVal; // Expand value parameter for array "reallocation"

	bool reallocArray(); // Reallocates the array when it is full. Returns TRUE on success.

	void makeSpace(int index); // Shifts elements to the right, to make room for new element

	void reduceSpace(int index); // Shifts elements to the left, for remove operation

	//T* lookup(const T& value) const;
};

#include "Array_t.hpp"

#endif // _INC_ARRAY_T_H_